import {
  postFormDataProxy,
  postFormProxy,
  getProxy,
  postJsonProxy,
  putJsonProxy
} from '@/utils/http/proxy'

const apiGetContentList = postFormProxy('#/api/b/content/getContentList')<
  TABLE_PARAMS.ListData,
  TABLE_PARAMS.RequestData
>
const upload = postFormDataProxy('#/api/b/content/upload')<
  TABLE_PARAMS.ListData,
  TABLE_PARAMS.RequestFileData
>

// 获取字典类型
const apiGetDictTypeList = getProxy('TAGCORE/dict/types/V2')<
  TABLE_PARAMS.DictTypeResponseData,
  TABLE_PARAMS.PropertyRequestData
>
// 获取字典值列表
const apiGetDictValuesList = getProxy('TAGCORE/dict/values/V1')<
  GOLBAL_PARAMS.ListData<TABLE_PARAMS.DictResponseData>,
  TABLE_PARAMS.DictValueRequestData
>

// 获取属性列表
const apiGetPropertyList = postJsonProxy('BIPLATFORM/meta-entity/property/list')<
  GOLBAL_PARAMS.ListData<TABLE_PARAMS.EntityProperty>,
  TABLE_PARAMS.PropertyRequestData
>

// 获取属性列表
const apiGetMetaEntityList = postJsonProxy('BIPLATFORM/meta-entity/list')<
  GOLBAL_PARAMS.ListData<TABLE_PARAMS.MetaEntity>,
  TABLE_PARAMS.MetaEntityRequestData
>

// 更新实体元数据
const apiUpdateMetaEntity = putJsonProxy('BIPLATFORM/meta-entity/update')<
  string,
  TABLE_PARAMS.MetaEntity
>

// 更新实体元数据属性
const apiUpdateMetaEntityProperty = putJsonProxy('BIPLATFORM/meta-entity/property/update')<
  string,
  TABLE_PARAMS.EntityProperty
>

// 新增实体
const apiCreateMetaEntity = postJsonProxy('BIPLATFORM/meta-entity/create')<
  string,
  TABLE_PARAMS.MetaEntity
>

export {
  apiGetPropertyList,
  apiGetMetaEntityList,
  apiUpdateMetaEntity,
  apiUpdateMetaEntityProperty,
  apiCreateMetaEntity,
  apiGetDictTypeList,
  apiGetDictValuesList,
  apiGetContentList,
  upload
}
